import http from '@/utils/request'
import { PageParams } from '@/types/goods'

/**
 * 获取商品详情
 */
export const findGoods = (id: string) =>
  http({
    url: '/goods',
    params: { id }
  })

/**
 * 获取商品同类推荐
 */
export const findRelGoods = (id: string, limit = 16) =>
  http({
    url: `/goods/relevant`,
    params: { id, limit }
  })

/**
 * 获得热榜商品
 */
export const findHotGoods = (id: string, type: number, limit = 3) =>
  http({
    url: '/goods/hot',
    params: { id, type, limit }
  })

/**
 * 获取商品的评价统计信息
 */
export const findCommentInfoByGoods = (id: string) =>
  http({
    url: `https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate`
  })

/**
 * 获取商品评价列表
 */
export const findCommentListByGoods = (id: string, params: PageParams) =>
  http({
    url: `https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate/page`,
    params
  })
